package com.haoshuang.zhouzhoubang.ui.page.home.settings.skill.passed

import com.haoshuang.zhouzhoubang.model.api.ApiRepo
import com.haoshuang.zhouzhoubang.model.bean.SkillAddBean
import com.mufeng.libs.base.BaseViewModel
import com.mufeng.libs.net.ResponseBean
import com.mufeng.libs.net.netRequest
import com.mufeng.libs.state.StateData
import com.mufeng.libs.state.StatefulMutableLiveData

class PassedSkillListViewModel : BaseViewModel() {

    /**
     * 获取添加技能展示列表
     */
    val getAddSkillListData = StatefulMutableLiveData<ResponseBean<MutableList<SkillAddBean>>>()
    fun getAddSkillList(type: Int) = netRequest {
        start { getAddSkillListData.value = StateData.Loading }
        request { ApiRepo.getAddSkillList(type) }
        success { getAddSkillListData.value = StateData.Success(it) }
        error { code, msg ->
            getAddSkillListData.value = StateData.Error(code, msg)
        }
    }

}